package top.tupobi.zing.broadcast;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

import com.blankj.utilcode.util.LogUtils;

import top.tupobi.zing.InfoRecord;
import top.tupobi.zing.mvp.view.AtyChat;
import top.tupobi.zing.mvp.view.AtyLogin;

import static top.tupobi.zing.base.BasePresenter.ACTIVITY_STATUS_DESTROYED;

public class NotificationClickReceiver extends BroadcastReceiver {

    @Override
    public void onReceive(Context context, Intent intent) {
        Intent newIntent;
        LogUtils.e("InfoRecord.getAtyChatStatus() == " + InfoRecord.getAtyChatStatus());
        if (InfoRecord.getAtyChatStatus() == ACTIVITY_STATUS_DESTROYED) {
            newIntent = new Intent(context, AtyLogin.class).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        } else {
            newIntent = new Intent(context, AtyChat.class).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        }
        context.startActivity(newIntent);
    }
}